#include<learning.h>

int main(int argc,char **argv)
{
	ARGS_CHECK(argc,2);

	int fd = open(argv[1],O_RDWR);
	RET_CHECK(fd,-1,"open");	
	int ret = ftruncate(fd,128);
	RET_CHECK(ret,-1,"ftruncate");

	char* p;
	p = (char *)mmap(NULL,5,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
	RET_CHECK(p,(char*)-1,"mmap");
	strcpy(p,"world\n");
	munmap(p,128);
	return 0;
}
